function Scroll(){
	this.init = function(wrapTarget){
        this.wrap = $(wrapTarget);
        this.inner = this.wrap.children("div");

        this.t = 1000;
        this.x = 100;
        this.pause = false;

        this.autoPlay();
        this.pausePlayEven();
	};
    this.play=function(){
        var xNow = this.wrap.scrollTop();
        if(xNow >= this.inner.outerHeight() - this.wrap.height()){
            this.x = -Math.abs(this.x);
        }else if(xNow === 0){
            this.x = Math.abs(this.x);
        }
        // this.wrap.scrollTop();
		var s = xNow+this.x;
		this.wrap.animate({scrollTop : s}, 500);
    };
    this.autoPlay=function(){
    	var o = this;
        if(o.time !== null){
            clearInterval(o.time);
            o.time = null;
        }
        o.time = setInterval(function(){
            o.play();
        }, o.t);
    };
    this.pausePlayEven=function(){
    	var o = this;
        o.wrap.mouseenter(function(){
            if(o.time !== null){
                clearInterval(o.time);
                o.time = null;
            }
        });
        o.wrap.mouseleave(function(){
            o.autoPlay();
        });
    }
}